﻿using System;
using System.Collections.Generic;
using System.Linq;
using Helpers;
using TaleWorlds.CampaignSystem.Actions;
using TaleWorlds.CampaignSystem.CharacterDevelopment;
using TaleWorlds.CampaignSystem.Conversation;
using TaleWorlds.CampaignSystem.Encounters;
using TaleWorlds.CampaignSystem.GameMenus;
using TaleWorlds.CampaignSystem.GameState;
using TaleWorlds.CampaignSystem.MapEvents;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.CampaignSystem.Roster;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.SaveSystem;

namespace TaleWorlds.CampaignSystem.Issues
{
	// Token: 0x0200030E RID: 782
	public class LandLordNeedsManualLaborersIssueBehavior : CampaignBehaviorBase
	{
		// Token: 0x06002D4F RID: 11599 RVA: 0x000BDABC File Offset: 0x000BBCBC
		public override void RegisterEvents()
		{
			CampaignEvents.OnCheckForIssueEvent.AddNonSerializedListener(this, new Action<Hero>(this.OnCheckForIssue));
		}

		// Token: 0x06002D50 RID: 11600 RVA: 0x000BDAD5 File Offset: 0x000BBCD5
		public override void SyncData(IDataStore dataStore)
		{
		}

		// Token: 0x06002D51 RID: 11601 RVA: 0x000BDAD8 File Offset: 0x000BBCD8
		private bool ConditionsHold(Hero issueGiver)
		{
			if (issueGiver.CurrentSettlement != null && issueGiver.IsRuralNotable && issueGiver.GetTraitLevel(DefaultTraits.Mercy) <= 0)
			{
				Village village = issueGiver.CurrentSettlement.Village;
				return village != null && (village.VillageType == DefaultVillageTypes.IronMine || village.VillageType == DefaultVillageTypes.ClayMine || village.VillageType == DefaultVillageTypes.SaltMine || village.VillageType == DefaultVillageTypes.SilverMine);
			}
			return false;
		}

		// Token: 0x06002D52 RID: 11602 RVA: 0x000BDB4C File Offset: 0x000BBD4C
		public void OnCheckForIssue(Hero hero)
		{
			if (this.ConditionsHold(hero))
			{
				Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(new PotentialIssueData.StartIssueDelegate(this.OnSelected), typeof(LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssue), IssueBase.IssueFrequency.VeryCommon, null));
				return;
			}
			Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(typeof(LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssue), IssueBase.IssueFrequency.VeryCommon));
		}

		// Token: 0x06002D53 RID: 11603 RVA: 0x000BDBB0 File Offset: 0x000BBDB0
		private IssueBase OnSelected(in PotentialIssueData pid, Hero issueOwner)
		{
			return new LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssue(issueOwner);
		}

		// Token: 0x04000D92 RID: 3474
		private const IssueBase.IssueFrequency NeedsLaborersIssueFrequency = IssueBase.IssueFrequency.VeryCommon;

		// Token: 0x0200063E RID: 1598
		public class LandLordNeedsManualLaborersIssue : IssueBase
		{
			// Token: 0x06004E71 RID: 20081 RVA: 0x00166EC4 File Offset: 0x001650C4
			internal static void AutoGeneratedStaticCollectObjectsLandLordNeedsManualLaborersIssue(object o, List<object> collectedObjects)
			{
				((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssue)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x06004E72 RID: 20082 RVA: 0x00166ED2 File Offset: 0x001650D2
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x17001026 RID: 4134
			// (get) Token: 0x06004E73 RID: 20083 RVA: 0x00166EDB File Offset: 0x001650DB
			public override IssueBase.AlternativeSolutionScaleFlag AlternativeSolutionScaleFlags
			{
				get
				{
					return IssueBase.AlternativeSolutionScaleFlag.RequiredTroops;
				}
			}

			// Token: 0x17001027 RID: 4135
			// (get) Token: 0x06004E74 RID: 20084 RVA: 0x00166EDE File Offset: 0x001650DE
			private int RequestedPrisonerCount
			{
				get
				{
					return 6 + MathF.Ceiling(30f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17001028 RID: 4136
			// (get) Token: 0x06004E75 RID: 20085 RVA: 0x00166EF3 File Offset: 0x001650F3
			public override int AlternativeSolutionBaseNeededMenCount
			{
				get
				{
					return 8 + MathF.Ceiling(12f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17001029 RID: 4137
			// (get) Token: 0x06004E76 RID: 20086 RVA: 0x00166F08 File Offset: 0x00165108
			protected override int AlternativeSolutionBaseDurationInDaysInternal
			{
				get
				{
					return 5 + MathF.Ceiling(5f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x1700102A RID: 4138
			// (get) Token: 0x06004E77 RID: 20087 RVA: 0x00166F1D File Offset: 0x0016511D
			protected override int RewardGold
			{
				get
				{
					return this.RequestedPrisonerCount * 50;
				}
			}

			// Token: 0x1700102B RID: 4139
			// (get) Token: 0x06004E78 RID: 20088 RVA: 0x00166F28 File Offset: 0x00165128
			public override TextObject IssueBriefByIssueGiver
			{
				get
				{
					TextObject result;
					if (base.IssueOwner.CharacterObject.GetTraitLevel(DefaultTraits.Mercy) < 0)
					{
						result = new TextObject("{=QEhapwtN}I own a mine near here. Normally I can find willing villagers to work it, but these days they've been demanding higher and higher wages. Fine. They're out of a job, but I still need to work the mine. If you could perhaps find me some prisoners...[if:convo_normal][ib:confident2]", null);
					}
					else
					{
						result = new TextObject("{=1LFcSRPw}I have a mine near here. We had an unfortunate accident a week back. Two workers were crushed to death. It's a great shame... but work must go on. Trouble is, no one wants to come back. If perhaps you could find me some prisoners...[if:convo_thinking][ib:hip]", null);
					}
					return result;
				}
			}

			// Token: 0x1700102C RID: 4140
			// (get) Token: 0x06004E79 RID: 20089 RVA: 0x00166F68 File Offset: 0x00165168
			public override TextObject IssueAcceptByPlayer
			{
				get
				{
					return new TextObject("{=DSMMIrz9}Prisoners... You want criminals or war captives?", null);
				}
			}

			// Token: 0x1700102D RID: 4141
			// (get) Token: 0x06004E7A RID: 20090 RVA: 0x00166F75 File Offset: 0x00165175
			public override TextObject IssueQuestSolutionExplanationByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=ji5kkqXy}They need to be criminals, bandits, for me to do this legally. I need at least {WANTED_PRISONER_AMOUNT} of them. But if you can bring more I will gladly accept. I'm willing to pay ten times more than their market price for each. What do you say?[if:convo_nonchalant]", null);
					textObject.SetTextVariable("WANTED_PRISONER_AMOUNT", this.RequestedPrisonerCount);
					return textObject;
				}
			}

			// Token: 0x1700102E RID: 4142
			// (get) Token: 0x06004E7B RID: 20091 RVA: 0x00166F94 File Offset: 0x00165194
			public override TextObject IssueAlternativeSolutionExplanationByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=WpidwcAV}If you have a companion who understands this type of work and {ALTERNATIVE_TROOP_AMOUNT} men, I can tell them where to go to get their hands on some prisoners.", null);
					textObject.SetTextVariable("ALTERNATIVE_TROOP_AMOUNT", base.GetTotalAlternativeSolutionNeededMenCount());
					return textObject;
				}
			}

			// Token: 0x1700102F RID: 4143
			// (get) Token: 0x06004E7C RID: 20092 RVA: 0x00166FB3 File Offset: 0x001651B3
			public override TextObject IssueQuestSolutionAcceptByPlayer
			{
				get
				{
					TextObject textObject = new TextObject("{=C06TxxnM}I'll bring you at least {WANTED_PRISONER_AMOUNT} prisoners as soon as possible.", null);
					textObject.SetTextVariable("WANTED_PRISONER_AMOUNT", this.RequestedPrisonerCount);
					return textObject;
				}
			}

			// Token: 0x17001030 RID: 4144
			// (get) Token: 0x06004E7D RID: 20093 RVA: 0x00166FD2 File Offset: 0x001651D2
			public override TextObject IssueAlternativeSolutionAcceptByPlayer
			{
				get
				{
					return new TextObject("{=QH3shVzb}My people can bring you your laborers.", null);
				}
			}

			// Token: 0x17001031 RID: 4145
			// (get) Token: 0x06004E7E RID: 20094 RVA: 0x00166FDF File Offset: 0x001651DF
			public override TextObject IssueDiscussAlternativeSolution
			{
				get
				{
					return new TextObject("{=XXOlu6z0}Thank you for sparing some of your men to save my business. I am looking forward to resuming work.[if:convo_mocking_teasing]", null);
				}
			}

			// Token: 0x17001032 RID: 4146
			// (get) Token: 0x06004E7F RID: 20095 RVA: 0x00166FEC File Offset: 0x001651EC
			public override TextObject IssueAlternativeSolutionResponseByIssueGiver
			{
				get
				{
					return new TextObject("{=PrzguaEq}Thank you. I appreciate your people's help.", null);
				}
			}

			// Token: 0x17001033 RID: 4147
			// (get) Token: 0x06004E80 RID: 20096 RVA: 0x00166FF9 File Offset: 0x001651F9
			public override bool IsThereAlternativeSolution
			{
				get
				{
					return true;
				}
			}

			// Token: 0x17001034 RID: 4148
			// (get) Token: 0x06004E81 RID: 20097 RVA: 0x00166FFC File Offset: 0x001651FC
			public override bool IsThereLordSolution
			{
				get
				{
					return false;
				}
			}

			// Token: 0x17001035 RID: 4149
			// (get) Token: 0x06004E82 RID: 20098 RVA: 0x00167000 File Offset: 0x00165200
			protected override TextObject AlternativeSolutionStartLog
			{
				get
				{
					TextObject textObject = new TextObject("{=MYeCnHTb}You asked {COMPANION.LINK} to deliver at least {WANTED_PRISONER_AMOUNT} prisoners to {ISSUE_GIVER.LINK} in {SETTLEMENT}. They should rejoin your party in {RETURN_DAYS} days.", null);
					StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.IssueOwner.CharacterObject, textObject, false);
					StringHelpers.SetCharacterProperties("COMPANION", base.AlternativeSolutionHero.CharacterObject, textObject, false);
					textObject.SetTextVariable("WANTED_PRISONER_AMOUNT", this.RequestedPrisonerCount);
					textObject.SetTextVariable("SETTLEMENT", base.IssueOwner.CurrentSettlement.EncyclopediaLinkWithName);
					textObject.SetTextVariable("RETURN_DAYS", base.GetTotalAlternativeSolutionDurationInDays());
					return textObject;
				}
			}

			// Token: 0x17001036 RID: 4150
			// (get) Token: 0x06004E83 RID: 20099 RVA: 0x0016708A File Offset: 0x0016528A
			public override TextObject Title
			{
				get
				{
					return new TextObject("{=hVIsGd2y}Landowner Needs Manual Laborers", null);
				}
			}

			// Token: 0x17001037 RID: 4151
			// (get) Token: 0x06004E84 RID: 20100 RVA: 0x00167097 File Offset: 0x00165297
			public override TextObject Description
			{
				get
				{
					TextObject result = new TextObject("{=5of4a1kg}A landowner needs your help to find prisoners to use in {?ISSUE_GIVER.GENDER}her{?}his{\\?} mines as manual laborers.", null);
					StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.IssueOwner.CharacterObject, null, false);
					return result;
				}
			}

			// Token: 0x06004E85 RID: 20101 RVA: 0x001670BC File Offset: 0x001652BC
			public LandLordNeedsManualLaborersIssue(Hero issueOwner) : base(issueOwner, CampaignTime.DaysFromNow(30f))
			{
			}

			// Token: 0x06004E86 RID: 20102 RVA: 0x001670CF File Offset: 0x001652CF
			protected override float GetIssueEffectAmountInternal(IssueEffect issueEffect)
			{
				if (issueEffect == DefaultIssueEffects.VillageHearth)
				{
					return -0.3f;
				}
				if (issueEffect == DefaultIssueEffects.IssueOwnerPower)
				{
					return -0.1f;
				}
				return 0f;
			}

			// Token: 0x06004E87 RID: 20103 RVA: 0x001670F2 File Offset: 0x001652F2
			public override ValueTuple<SkillObject, int> GetAlternativeSolutionSkill(Hero hero)
			{
				return new ValueTuple<SkillObject, int>((hero.GetSkillValue(DefaultSkills.Athletics) >= hero.GetSkillValue(DefaultSkills.Leadership)) ? DefaultSkills.Athletics : DefaultSkills.Leadership, 120);
			}

			// Token: 0x06004E88 RID: 20104 RVA: 0x0016711F File Offset: 0x0016531F
			public override bool DoTroopsSatisfyAlternativeSolution(TroopRoster troopRoster, out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(troopRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false);
			}

			// Token: 0x06004E89 RID: 20105 RVA: 0x00167137 File Offset: 0x00165337
			public override bool AlternativeSolutionCondition(out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(MobileParty.MainParty.MemberRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false);
			}

			// Token: 0x06004E8A RID: 20106 RVA: 0x00167158 File Offset: 0x00165358
			public override bool IsTroopTypeNeededByAlternativeSolution(CharacterObject character)
			{
				return character.Tier >= 2;
			}

			// Token: 0x06004E8B RID: 20107 RVA: 0x00167166 File Offset: 0x00165366
			public override IssueBase.IssueFrequency GetFrequency()
			{
				return IssueBase.IssueFrequency.VeryCommon;
			}

			// Token: 0x06004E8C RID: 20108 RVA: 0x00167169 File Offset: 0x00165369
			public override bool IssueStayAliveConditions()
			{
				return !base.IssueOwner.CurrentSettlement.IsRaided && !base.IssueOwner.CurrentSettlement.IsUnderRaid;
			}

			// Token: 0x06004E8D RID: 20109 RVA: 0x00167194 File Offset: 0x00165394
			protected override bool CanPlayerTakeQuestConditions(Hero issueGiver, out IssueBase.PreconditionFlags flags, out Hero relationHero, out SkillObject skill)
			{
				flags = IssueBase.PreconditionFlags.None;
				relationHero = null;
				skill = null;
				if (issueGiver.GetRelationWithPlayer() < -10f)
				{
					flags |= IssueBase.PreconditionFlags.Relation;
					relationHero = issueGiver;
				}
				if (FactionManager.IsAtWarAgainstFaction(issueGiver.MapFaction, Hero.MainHero.MapFaction))
				{
					flags |= IssueBase.PreconditionFlags.AtWar;
				}
				return flags == IssueBase.PreconditionFlags.None;
			}

			// Token: 0x06004E8E RID: 20110 RVA: 0x001671E4 File Offset: 0x001653E4
			protected override void OnGameLoad()
			{
			}

			// Token: 0x06004E8F RID: 20111 RVA: 0x001671E6 File Offset: 0x001653E6
			protected override void HourlyTick()
			{
			}

			// Token: 0x06004E90 RID: 20112 RVA: 0x001671E8 File Offset: 0x001653E8
			protected override QuestBase GenerateIssueQuest(string questId)
			{
				return new LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest(questId, base.IssueOwner, CampaignTime.DaysFromNow(20f), this.RequestedPrisonerCount);
			}

			// Token: 0x06004E91 RID: 20113 RVA: 0x00167206 File Offset: 0x00165406
			protected override void CompleteIssueWithTimedOutConsequences()
			{
			}

			// Token: 0x17001038 RID: 4152
			// (get) Token: 0x06004E92 RID: 20114 RVA: 0x00167208 File Offset: 0x00165408
			protected override int CompanionSkillRewardXP
			{
				get
				{
					return (int)(500f + 700f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x06004E93 RID: 20115 RVA: 0x0016721D File Offset: 0x0016541D
			protected override void AlternativeSolutionEndWithSuccessConsequence()
			{
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.IssueOwner, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, 30)
				});
				base.IssueOwner.AddPower(10f);
				this.RelationshipChangeWithIssueOwner = 5;
			}

			// Token: 0x04001A26 RID: 6694
			private const int IssueDuration = 30;

			// Token: 0x04001A27 RID: 6695
			private const int QuestDuration = 20;

			// Token: 0x04001A28 RID: 6696
			private const int AlternativeSolutionTroopTierRequirement = 2;

			// Token: 0x04001A29 RID: 6697
			private const int CompanionRequiredSkillLevel = 120;
		}

		// Token: 0x0200063F RID: 1599
		public class LandLordNeedsManualLaborersIssueQuest : QuestBase
		{
			// Token: 0x06004E94 RID: 20116 RVA: 0x00167256 File Offset: 0x00165456
			internal static void AutoGeneratedStaticCollectObjectsLandLordNeedsManualLaborersIssueQuest(object o, List<object> collectedObjects)
			{
				((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x06004E95 RID: 20117 RVA: 0x00167264 File Offset: 0x00165464
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
				collectedObjects.Add(this._questProgressLogTest);
			}

			// Token: 0x06004E96 RID: 20118 RVA: 0x00167279 File Offset: 0x00165479
			internal static object AutoGeneratedGetMemberValue_requestedPrisonerCount(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._requestedPrisonerCount;
			}

			// Token: 0x06004E97 RID: 20119 RVA: 0x0016728B File Offset: 0x0016548B
			internal static object AutoGeneratedGetMemberValue_shareProfit(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._shareProfit;
			}

			// Token: 0x06004E98 RID: 20120 RVA: 0x0016729D File Offset: 0x0016549D
			internal static object AutoGeneratedGetMemberValue_counterOfferGiven(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._counterOfferGiven;
			}

			// Token: 0x06004E99 RID: 20121 RVA: 0x001672AF File Offset: 0x001654AF
			internal static object AutoGeneratedGetMemberValue_deliveredPrisonerCount(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._deliveredPrisonerCount;
			}

			// Token: 0x06004E9A RID: 20122 RVA: 0x001672C1 File Offset: 0x001654C1
			internal static object AutoGeneratedGetMemberValue_rewardGold(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._rewardGold;
			}

			// Token: 0x06004E9B RID: 20123 RVA: 0x001672D3 File Offset: 0x001654D3
			internal static object AutoGeneratedGetMemberValue_maximumPrisonerCount(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._maximumPrisonerCount;
			}

			// Token: 0x06004E9C RID: 20124 RVA: 0x001672E5 File Offset: 0x001654E5
			internal static object AutoGeneratedGetMemberValue_playerReachedMaximumAmount(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._playerReachedMaximumAmount;
			}

			// Token: 0x06004E9D RID: 20125 RVA: 0x001672F7 File Offset: 0x001654F7
			internal static object AutoGeneratedGetMemberValue_questProgressLogTest(object o)
			{
				return ((LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest)o)._questProgressLogTest;
			}

			// Token: 0x17001039 RID: 4153
			// (get) Token: 0x06004E9E RID: 20126 RVA: 0x00167304 File Offset: 0x00165504
			public override TextObject Title
			{
				get
				{
					return new TextObject("{=hVIsGd2y}Landowner Needs Manual Laborers", null);
				}
			}

			// Token: 0x1700103A RID: 4154
			// (get) Token: 0x06004E9F RID: 20127 RVA: 0x00167311 File Offset: 0x00165511
			public override bool IsRemainingTimeHidden
			{
				get
				{
					return false;
				}
			}

			// Token: 0x1700103B RID: 4155
			// (get) Token: 0x06004EA0 RID: 20128 RVA: 0x00167314 File Offset: 0x00165514
			private bool IsQuestWithCounterOffer
			{
				get
				{
					if (base.QuestGiver.CharacterObject.GetTraitLevel(DefaultTraits.Mercy) < 0)
					{
						return base.QuestGiver.CurrentSettlement.Notables.FirstOrDefault((Hero x) => x.IsHeadman) != null;
					}
					return false;
				}
			}

			// Token: 0x1700103C RID: 4156
			// (get) Token: 0x06004EA1 RID: 20129 RVA: 0x00167374 File Offset: 0x00165574
			private TextObject QuestStartedLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=7XR4MJci}{QUEST_GIVER.LINK}, a landowner in {SETTLEMENT}, told you that {?QUEST_GIVER.GENDER}she{?}he{\\?} needs prisoners to use in {?QUEST_GIVER.GENDER}her{?}his{\\?} mines as manual laborers. {?QUEST_GIVER.GENDER}She{?}He{\\?} asked you to bring at least {NEEDED_PRISONER_AMOUNT} bandit prisoners, but {?QUEST_GIVER.GENDER}she{?}he{\\?} will pay extra if you bring more. You have agreed to bring {?QUEST_GIVER.GENDER}her{?}him{\\?} at least {NEEDED_PRISONER_AMOUNT} bandit prisoner and you will be paid ten times more than their market price for each prisoner you bring.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("SETTLEMENT", base.QuestGiver.CurrentSettlement.EncyclopediaLinkWithName);
					textObject.SetTextVariable("NEEDED_PRISONER_AMOUNT", this._requestedPrisonerCount);
					return textObject;
				}
			}

			// Token: 0x1700103D RID: 4157
			// (get) Token: 0x06004EA2 RID: 20130 RVA: 0x001673D4 File Offset: 0x001655D4
			private TextObject QuestCanceledWarDeclaredLog
			{
				get
				{
					TextObject textObject = new TextObject("{=vW6kBki9}Your clan is now at war with {QUEST_GIVER.LINK}'s realm. Your agreement with {QUEST_GIVER.LINK} is canceled.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x1700103E RID: 4158
			// (get) Token: 0x06004EA3 RID: 20131 RVA: 0x00167408 File Offset: 0x00165608
			private TextObject PlayerDeclaredWarQuestLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=bqeWVVEE}Your actions have started a war with {QUEST_GIVER.LINK}'s faction. {?QUEST_GIVER.GENDER}She{?}He{\\?} cancels your agreement and the quest is a failure.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x1700103F RID: 4159
			// (get) Token: 0x06004EA4 RID: 20132 RVA: 0x0016743C File Offset: 0x0016563C
			private TextObject QuestGiverVillageRaided
			{
				get
				{
					TextObject textObject = new TextObject("{=gJG0xmAq}{QUEST_GIVER.LINK}'s village {QUEST_SETTLEMENT} was raided. Your agreement with {QUEST_GIVER.LINK} is canceled.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("QUEST_SETTLEMENT", base.QuestGiver.CurrentSettlement.EncyclopediaLinkWithName);
					return textObject;
				}
			}

			// Token: 0x17001040 RID: 4160
			// (get) Token: 0x06004EA5 RID: 20133 RVA: 0x0016748C File Offset: 0x0016568C
			private TextObject QuestSuccessLog
			{
				get
				{
					TextObject textObject = new TextObject("{=ucu9u1nS}You delivered the prisoners to {QUEST_GIVER.LINK} as promised.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17001041 RID: 4161
			// (get) Token: 0x06004EA6 RID: 20134 RVA: 0x001674BE File Offset: 0x001656BE
			private TextObject PlayerSharedTheProfitWithHeadManLogText
			{
				get
				{
					return new TextObject("{=ULpP07bg}You promised to share half of the profit with the headman and the villager.", null);
				}
			}

			// Token: 0x17001042 RID: 4162
			// (get) Token: 0x06004EA7 RID: 20135 RVA: 0x001674CC File Offset: 0x001656CC
			private TextObject QuestSuccessWithProfitShareLog
			{
				get
				{
					TextObject textObject = new TextObject("{=SyuxD1aY}You delivered the prisoners to {QUEST_GIVER.LINK} as promised and you shared half of the profit with the headman and the villagers.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17001043 RID: 4163
			// (get) Token: 0x06004EA8 RID: 20136 RVA: 0x00167500 File Offset: 0x00165700
			private TextObject QuestFailPlayerAcceptedCounterOfferLog
			{
				get
				{
					TextObject textObject = new TextObject("{=u8DJ8a2D}You agreed with the headman to break your agreement with {QUEST_GIVER.LINK}. By doing so you protected the villagers' jobs and now they are grateful to you.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17001044 RID: 4164
			// (get) Token: 0x06004EA9 RID: 20137 RVA: 0x00167534 File Offset: 0x00165734
			private TextObject QuestFailedWithTimeOutLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=b1lsZNxE}You failed to deliver enough prisoners in time. {QUEST_GIVER.LINK} must be disappointed.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x06004EAA RID: 20138 RVA: 0x00167568 File Offset: 0x00165768
			public LandLordNeedsManualLaborersIssueQuest(string questId, Hero giverHero, CampaignTime duration, int requestedPrisonerCount) : base(questId, giverHero, duration, 0)
			{
				this._requestedPrisonerCount = requestedPrisonerCount;
				this._shareProfit = false;
				this._deliveredPrisonerCount = 0;
				this._rewardGold = 0;
				this._counterOfferGiven = false;
				this._maximumPrisonerCount = MBRandom.RandomInt(40, 60);
				this._playerReachedMaximumAmount = false;
				this.SetDialogs();
				base.InitializeQuestOnCreation();
			}

			// Token: 0x06004EAB RID: 20139 RVA: 0x001675C8 File Offset: 0x001657C8
			private void QuestAcceptedConsequences()
			{
				base.StartQuest();
				base.AddTrackedObject(base.QuestGiver.CurrentSettlement);
				TextObject textObject = new TextObject("{=N4eLGduQ}Delivered Prisoners ({TOTAL_REWARD}{GOLD_ICON})", null);
				textObject.SetTextVariable("TOTAL_REWARD", this._rewardGold);
				textObject.SetTextVariable("GOLD_ICON", "{=!}<img src=\"General\\Icons\\Coin@2x\" extend=\"8\">");
				this._questProgressLogTest = base.AddDiscreteLog(this.QuestStartedLogText, textObject, this._deliveredPrisonerCount, this._requestedPrisonerCount, null, false);
			}

			// Token: 0x06004EAC RID: 20140 RVA: 0x0016763C File Offset: 0x0016583C
			private DialogFlow GetCounterOfferDialogFlow()
			{
				TextObject textObject = new TextObject("{=aJHMafam}{?PLAYER.GENDER}Madam{?}Sir{\\?} - a moment of your time! [if:convo_undecided_open][ib:nervous2]You're on a job for {ISSUE_GIVER.LINK}, am I right? Look - our people are depending on those jobs. {?ISSUE_GIVER.GENDER}She{?}He{\\?} doesn't need to pay us a living wage if {?ISSUE_GIVER.GENDER}she{?}he{\\?} can do the work with prisoners. Please - break your agreement. You don't have to do this.", null);
				StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, textObject, false);
				StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.QuestGiver.CharacterObject, textObject, false);
				TextObject textObject2 = new TextObject("{=8BdJ2MZj}I don't want to hurt your people. I'll forget my deal with {ISSUE_GIVER.LINK}.", null);
				StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.QuestGiver.CharacterObject, textObject2, false);
				return DialogFlow.CreateDialogFlow("start", 125).NpcLine(textObject, null, null).Condition(delegate
				{
					if (!this._counterOfferGiven && Hero.OneToOneConversationHero != null)
					{
						return Hero.OneToOneConversationHero == base.QuestGiver.CurrentSettlement.Notables.FirstOrDefault((Hero x) => x.IsHeadman);
					}
					return false;
				}).Consequence(delegate
				{
					this._counterOfferGiven = true;
				}).BeginPlayerOptions().PlayerOption("{=rOWyAHPo}Mind your own business, Headman.", null).NpcLine("{=tLapkQqg}We won't forget this![if:convo_thinking][ib:aggressive]", null, null).Consequence(delegate
				{
					ChangeRelationAction.ApplyPlayerRelation(Hero.OneToOneConversationHero, -3, true, true);
				}).CloseDialog().PlayerOption("{=I3GUAb9a}I understand your concern, Headman, but I made an agreement. How about I share the profit with you and your people?", null).NpcLine("{=MmQt0TD3}This is not we want, but it's more than nothing.[if:convo_dismayed][ib:normal]", null, null).Consequence(new ConversationSentence.OnConsequenceDelegate(this.ShareTheProfit)).CloseDialog().PlayerOption(textObject2, null).NpcLine("{=E5yAFR6y}Good to hear that. Thank you.[if:convo_relaxed_happy][ib:normal]", null, null).Consequence(new ConversationSentence.OnConsequenceDelegate(this.QuestFailPlayerAcceptedCounterOffer)).CloseDialog().EndPlayerOptions().CloseDialog();
			}

			// Token: 0x06004EAD RID: 20141 RVA: 0x0016777E File Offset: 0x0016597E
			private void ShareTheProfit()
			{
				base.AddLog(this.PlayerSharedTheProfitWithHeadManLogText, false);
				ChangeRelationAction.ApplyPlayerRelation(Hero.OneToOneConversationHero, 3, true, true);
				this._shareProfit = true;
			}

			// Token: 0x06004EAE RID: 20142 RVA: 0x001677A4 File Offset: 0x001659A4
			protected override void SetDialogs()
			{
				this.OfferDialogFlow = DialogFlow.CreateDialogFlow("issue_classic_quest_start", 100).NpcLine(new TextObject("{=l7dL6arZ}Thank you. Remember - they need to be looters or bandits. Anyone else I can't put to work.[if:convo_mocking_teasing][ib:closed]", null), null, null).Condition(() => Hero.OneToOneConversationHero == this.QuestGiver).Consequence(new ConversationSentence.OnConsequenceDelegate(this.QuestAcceptedConsequences)).CloseDialog();
				TextObject npcDiscussLine = new TextObject("{=!}{MANUAL_LABORERS_QUEST_NOTABLE_DISCUSS}", null);
				TextObject npcResponseLine = new TextObject("{=!}{MANUAL_LABORERS_QUEST_NOTABLE_RESPONSE}", null);
				bool changeDialogAfterTransfer = false;
				this.DiscussDialogFlow = DialogFlow.CreateDialogFlow("quest_discuss", 100).BeginNpcOptions().NpcOption(new TextObject("{=VRLbAaYe}Thank you for saving my business {?PLAYER.GENDER}madam{?}sir{\\?}. Here is your payment.", null), () => Hero.OneToOneConversationHero == this.QuestGiver && this._playerReachedMaximumAmount, null, null).Consequence(delegate
				{
					this.ApplyQuestSuccessConsequences();
					this.CompleteQuestWithSuccess();
				}).CloseDialog().NpcOption(npcDiscussLine, delegate()
				{
					if (Hero.OneToOneConversationHero != this.QuestGiver)
					{
						return false;
					}
					if (!changeDialogAfterTransfer)
					{
						npcDiscussLine.SetTextVariable("MANUAL_LABORERS_QUEST_NOTABLE_DISCUSS", new TextObject("{=B0YOpGsZ}Any news about my prisoners?[if:convo_mocking_teasing][ib:hip]", null));
					}
					else
					{
						npcDiscussLine.SetTextVariable("MANUAL_LABORERS_QUEST_NOTABLE_DISCUSS", new TextObject("{=ds294zxi}Anything else?", null));
						changeDialogAfterTransfer = false;
					}
					return true;
				}, null, null).BeginPlayerOptions().PlayerOption(new TextObject("{=QbaOoilS}Yes, I have brought you a few men.", null), null).Condition(() => this.CheckIfThereIsSuitablePrisonerInPlayer() && !this._playerReachedMaximumAmount).NpcLine(npcResponseLine, null, null).Condition(delegate
				{
					if (this._playerReachedMaximumAmount)
					{
						return false;
					}
					if ((float)this._deliveredPrisonerCount < (float)this._maximumPrisonerCount * 0.75f)
					{
						npcResponseLine.SetTextVariable("MANUAL_LABORERS_QUEST_NOTABLE_RESPONSE", new TextObject("{=0ewaZnfe}Very good. Keep them coming.[if:convo_mocking_aristocratic]", null));
					}
					else
					{
						TextObject textObject = new TextObject("{=CBBPWMZd}Thanks to you, my mines are full {?PLAYER.GENDER}madam{?}sir{\\?}. I will only buy {X} more then we're done.", null);
						textObject.SetTextVariable("X", this._maximumPrisonerCount - this._deliveredPrisonerCount);
						npcResponseLine.SetTextVariable("MANUAL_LABORERS_QUEST_NOTABLE_RESPONSE", textObject);
						changeDialogAfterTransfer = false;
					}
					return true;
				}).PlayerLine(new TextObject("{=IULW8h03}Sure.", null), null).Consequence(delegate
				{
					changeDialogAfterTransfer = true;
					this.OpenPrisonerDeliveryScreen();
				}).NpcLine(new TextObject("{=!}Party screen goes here.", null), null, null).GotoDialogState("quest_discuss").PlayerOption(new TextObject("{=UOE7ejgq}Here is all I've got. Let's settle up and finish this business.", null), null).Condition(() => !this._playerReachedMaximumAmount && this._deliveredPrisonerCount >= this._requestedPrisonerCount).NpcLine(new TextObject("{=YZ6UmX5o}Certainly. Here is your payment as I promised. Thank you.[if:convo_mocking_teasing][ib:confident3]", null), null, null).Consequence(delegate
				{
					this.ApplyQuestSuccessConsequences();
					this.CompleteQuestWithSuccess();
				}).CloseDialog().PlayerOption(new TextObject("{=wErSpkjy}I'm still working on it.", null), null).NpcLine(new TextObject("{=oiLdjqwe}I am glad to hear that.[if:convo_nonchalant]", null), null, null).CloseDialog().EndPlayerOptions();
				if (this.IsQuestWithCounterOffer)
				{
					this.QuestCharacterDialogFlow = this.GetCounterOfferDialogFlow();
				}
			}

			// Token: 0x06004EAF RID: 20143 RVA: 0x001679A4 File Offset: 0x00165BA4
			private void OpenPrisonerDeliveryScreen()
			{
				PartyScreenManager.OpenScreenWithCondition(new IsTroopTransferableDelegate(this.IsTroopTransferable), new PartyPresentationDoneButtonConditionDelegate(this.DoneButtonCondition), new PartyPresentationDoneButtonDelegate(this.OnDoneClicked), new PartyPresentationCancelButtonDelegate(this.OnCancelClicked), PartyScreenLogic.TransferState.NotTransferable, PartyScreenLogic.TransferState.Transferable, base.QuestGiver.Name, 150, false, false, PartyScreenMode.PrisonerManage, null, null);
			}

			// Token: 0x06004EB0 RID: 20144 RVA: 0x001679FD File Offset: 0x00165BFD
			private void OnCancelClicked()
			{
				Campaign.Current.ConversationManager.ContinueConversation();
			}

			// Token: 0x06004EB1 RID: 20145 RVA: 0x00167A10 File Offset: 0x00165C10
			private Tuple<bool, TextObject> DoneButtonCondition(TroopRoster leftMemberRoster, TroopRoster leftPrisonRoster, TroopRoster rightMemberRoster, TroopRoster rightPrisonRoster, int leftLimitNum, int rightLimitNum)
			{
				if (this._maximumPrisonerCount - this._deliveredPrisonerCount < leftPrisonRoster.TotalManCount)
				{
					int num = this._maximumPrisonerCount - this._deliveredPrisonerCount;
					TextObject textObject = new TextObject("{=bgXebaRF}You can only transfer {X} prisoner{?IS_PLURAL}s{?}{\\?}.", null);
					textObject.SetTextVariable("IS_PLURAL", (num > 1) ? 1 : 0);
					textObject.SetTextVariable("X", num);
					return new Tuple<bool, TextObject>(false, textObject);
				}
				return new Tuple<bool, TextObject>(true, null);
			}

			// Token: 0x06004EB2 RID: 20146 RVA: 0x00167A7C File Offset: 0x00165C7C
			private bool OnDoneClicked(TroopRoster leftMemberRoster, TroopRoster leftPrisonRoster, TroopRoster rightMemberRoster, TroopRoster rightPrisonRoster, FlattenedTroopRoster takenPrisonerRoster, FlattenedTroopRoster releasedPrisonerRoster, bool isForced, PartyBase leftParty, PartyBase rightParty)
			{
				foreach (TroopRosterElement troopRosterElement in leftPrisonRoster.GetTroopRoster())
				{
					this._rewardGold += Campaign.Current.Models.RansomValueCalculationModel.PrisonerRansomValue(troopRosterElement.Character, Hero.MainHero) * troopRosterElement.Number * 5;
					this._deliveredPrisonerCount += troopRosterElement.Number;
				}
				this._questProgressLogTest.UpdateCurrentProgress(this._deliveredPrisonerCount);
				this._questProgressLogTest.TaskName.SetTextVariable("TOTAL_REWARD", this._rewardGold);
				if (this._deliveredPrisonerCount == this._maximumPrisonerCount)
				{
					this._playerReachedMaximumAmount = true;
				}
				Campaign.Current.ConversationManager.ContinueConversation();
				return true;
			}

			// Token: 0x06004EB3 RID: 20147 RVA: 0x00167B64 File Offset: 0x00165D64
			private bool IsTroopTransferable(CharacterObject character, PartyScreenLogic.TroopType type, PartyScreenLogic.PartyRosterSide side, PartyBase leftOwnerParty)
			{
				return side == PartyScreenLogic.PartyRosterSide.Left || (this._maximumPrisonerCount - this._deliveredPrisonerCount >= 0 && MobileParty.MainParty.PrisonRoster.Contains(character) && character.Occupation == Occupation.Bandit);
			}

			// Token: 0x06004EB4 RID: 20148 RVA: 0x00167B9C File Offset: 0x00165D9C
			private bool CheckIfThereIsSuitablePrisonerInPlayer()
			{
				bool result = false;
				using (List<TroopRosterElement>.Enumerator enumerator = MobileParty.MainParty.PrisonRoster.GetTroopRoster().GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						if (enumerator.Current.Character.Occupation == Occupation.Bandit)
						{
							result = true;
							break;
						}
					}
				}
				return result;
			}

			// Token: 0x06004EB5 RID: 20149 RVA: 0x00167C08 File Offset: 0x00165E08
			private void ApplyQuestSuccessConsequences()
			{
				if (this._shareProfit)
				{
					base.AddLog(this.QuestSuccessWithProfitShareLog, false);
					TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
					{
						new Tuple<TraitObject, int>(DefaultTraits.Honor, 30)
					});
					GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, this._rewardGold / 2, false);
					if (this.IsQuestWithCounterOffer)
					{
						base.QuestGiver.CurrentSettlement.Notables.First((Hero x) => x.IsHeadman).AddPower(5f);
					}
				}
				else
				{
					base.AddLog(this.QuestSuccessLog, false);
					TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
					{
						new Tuple<TraitObject, int>(DefaultTraits.Honor, 30),
						new Tuple<TraitObject, int>(DefaultTraits.Mercy, -20)
					});
					GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, this._rewardGold, false);
					if (this.IsQuestWithCounterOffer && this._counterOfferGiven)
					{
						ChangeRelationAction.ApplyPlayerRelation(base.QuestGiver.CurrentSettlement.Notables.First((Hero x) => x.IsHeadman), -5, true, true);
						base.QuestGiver.CurrentSettlement.Notables.First((Hero x) => x.IsHeadman).AddPower(-10f);
					}
				}
				base.QuestGiver.AddPower(10f);
				this.RelationshipChangeWithQuestGiver = 5;
			}

			// Token: 0x06004EB6 RID: 20150 RVA: 0x00167DA4 File Offset: 0x00165FA4
			private void QuestFailPlayerAcceptedCounterOffer()
			{
				base.AddLog(this.QuestFailPlayerAcceptedCounterOfferLog, false);
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Mercy, 20),
					new Tuple<TraitObject, int>(DefaultTraits.Generosity, 20),
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -10)
				});
				base.QuestGiver.AddPower(-10f);
				this.RelationshipChangeWithQuestGiver = -3;
				Hero hero = base.QuestGiver.CurrentSettlement.Notables.First((Hero x) => x.IsHeadman);
				hero.AddPower(10f);
				ChangeRelationAction.ApplyPlayerRelation(hero, 5, true, true);
				base.CompleteQuestWithFail(null);
			}

			// Token: 0x06004EB7 RID: 20151 RVA: 0x00167E63 File Offset: 0x00166063
			protected override void OnBeforeTimedOut(ref bool completeWithSuccess, ref bool doNotResolveTheQuest)
			{
				if (this._deliveredPrisonerCount >= this._requestedPrisonerCount)
				{
					completeWithSuccess = true;
					this.ApplyQuestSuccessConsequences();
				}
			}

			// Token: 0x06004EB8 RID: 20152 RVA: 0x00167E7C File Offset: 0x0016607C
			protected override void OnTimedOut()
			{
				base.AddLog(this.QuestFailedWithTimeOutLogText, false);
				base.QuestGiver.AddPower(-10f);
				this.RelationshipChangeWithQuestGiver = -5;
			}

			// Token: 0x06004EB9 RID: 20153 RVA: 0x00167EA4 File Offset: 0x001660A4
			protected override void HourlyTick()
			{
			}

			// Token: 0x06004EBA RID: 20154 RVA: 0x00167EA8 File Offset: 0x001660A8
			protected override void RegisterEvents()
			{
				CampaignEvents.WarDeclared.AddNonSerializedListener(this, new Action<IFaction, IFaction, DeclareWarAction.DeclareWarDetail>(this.OnWarDeclared));
				CampaignEvents.OnClanChangedKingdomEvent.AddNonSerializedListener(this, new Action<Clan, Kingdom, Kingdom, ChangeKingdomAction.ChangeKingdomActionDetail, bool>(this.OnClanChangedKingdom));
				CampaignEvents.VillageBeingRaided.AddNonSerializedListener(this, new Action<Village>(this.OnVillageRaided));
				CampaignEvents.GameMenuOpened.AddNonSerializedListener(this, new Action<MenuCallbackArgs>(this.OnGameMenuOpened));
				CampaignEvents.MapEventStarted.AddNonSerializedListener(this, new Action<MapEvent, PartyBase, PartyBase>(this.OnMapEventStarted));
			}

			// Token: 0x06004EBB RID: 20155 RVA: 0x00167F28 File Offset: 0x00166128
			private void OnMapEventStarted(MapEvent mapEvent, PartyBase attackerParty, PartyBase defenderParty)
			{
				if (QuestHelper.CheckMinorMajorCoercion(this, mapEvent, attackerParty))
				{
					QuestHelper.ApplyGenericMinorMajorCoercionConsequences(this, mapEvent);
				}
			}

			// Token: 0x06004EBC RID: 20156 RVA: 0x00167F3C File Offset: 0x0016613C
			private void OnGameMenuOpened(MenuCallbackArgs args)
			{
				if (this.IsQuestWithCounterOffer && !this._counterOfferGiven && args.MenuContext.GameMenu.StringId == "village" && Settlement.CurrentSettlement == base.QuestGiver.CurrentSettlement && Campaign.Current.GameMenuManager.NextLocation == null && GameStateManager.Current.ActiveState is MapState && PlayerEncounter.EncounterSettlement != null && this.CheckIfThereIsSuitablePrisonerInPlayer())
				{
					Hero hero = base.QuestGiver.CurrentSettlement.Notables.First((Hero x) => x.IsHeadman);
					CampaignMapConversation.OpenConversation(new ConversationCharacterData(CharacterObject.PlayerCharacter, PartyBase.MainParty, false, false, false, false, false, false), new ConversationCharacterData(hero.CharacterObject, null, false, false, false, false, false, false));
				}
			}

			// Token: 0x06004EBD RID: 20157 RVA: 0x00168028 File Offset: 0x00166228
			private void OnVillageRaided(Village village)
			{
				if (village == base.QuestGiver.CurrentSettlement.Village)
				{
					base.AddLog(this.QuestGiverVillageRaided, false);
					base.CompleteQuestWithCancel(null);
				}
			}

			// Token: 0x06004EBE RID: 20158 RVA: 0x00168052 File Offset: 0x00166252
			private void OnClanChangedKingdom(Clan clan, Kingdom oldKingdom, Kingdom newKingdom, ChangeKingdomAction.ChangeKingdomActionDetail detail, bool showNotification = true)
			{
				if (base.QuestGiver.CurrentSettlement.MapFaction.IsAtWarWith(Hero.MainHero.MapFaction))
				{
					base.CompleteQuestWithCancel(this.QuestCanceledWarDeclaredLog);
				}
			}

			// Token: 0x06004EBF RID: 20159 RVA: 0x00168081 File Offset: 0x00166281
			private void OnWarDeclared(IFaction faction1, IFaction faction2, DeclareWarAction.DeclareWarDetail detail)
			{
				QuestHelper.CheckWarDeclarationAndFailOrCancelTheQuest(this, faction1, faction2, detail, this.PlayerDeclaredWarQuestLogText, this.QuestCanceledWarDeclaredLog, false);
			}

			// Token: 0x06004EC0 RID: 20160 RVA: 0x00168099 File Offset: 0x00166299
			protected override void OnFinalize()
			{
			}

			// Token: 0x06004EC1 RID: 20161 RVA: 0x0016809B File Offset: 0x0016629B
			protected override void InitializeQuestOnGameLoad()
			{
				this.SetDialogs();
			}

			// Token: 0x04001A2A RID: 6698
			private const int MaximumPrisonerLimitMinValue = 40;

			// Token: 0x04001A2B RID: 6699
			private const int MaximumPrisonerLimitMaxValue = 60;

			// Token: 0x04001A2C RID: 6700
			[SaveableField(1)]
			private int _requestedPrisonerCount;

			// Token: 0x04001A2D RID: 6701
			[SaveableField(2)]
			private bool _shareProfit;

			// Token: 0x04001A2E RID: 6702
			[SaveableField(4)]
			private bool _counterOfferGiven;

			// Token: 0x04001A2F RID: 6703
			[SaveableField(5)]
			private int _deliveredPrisonerCount;

			// Token: 0x04001A30 RID: 6704
			[SaveableField(6)]
			private int _rewardGold;

			// Token: 0x04001A31 RID: 6705
			[SaveableField(8)]
			private int _maximumPrisonerCount;

			// Token: 0x04001A32 RID: 6706
			[SaveableField(9)]
			private bool _playerReachedMaximumAmount;

			// Token: 0x04001A33 RID: 6707
			[SaveableField(7)]
			private JournalLog _questProgressLogTest;
		}

		// Token: 0x02000640 RID: 1600
		public class LandLordNeedsManualLaborersIssueBehaviorTypeDefiner : SaveableTypeDefiner
		{
			// Token: 0x06004EC4 RID: 20164 RVA: 0x00168106 File Offset: 0x00166306
			public LandLordNeedsManualLaborersIssueBehaviorTypeDefiner() : base(810000)
			{
			}

			// Token: 0x06004EC5 RID: 20165 RVA: 0x00168113 File Offset: 0x00166313
			protected override void DefineClassTypes()
			{
				base.AddClassDefinition(typeof(LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssue), 1, null);
				base.AddClassDefinition(typeof(LandLordNeedsManualLaborersIssueBehavior.LandLordNeedsManualLaborersIssueQuest), 2, null);
			}
		}
	}
}
